let count = 0
let navtitle = $.ajax({
    url: "http://chst.vip:1234/api/getindexmenu",
})
    .then((res) => {
        console.log(res.result);
        let lis = '';
        res.result.forEach(item => {
            count++;
            lis += ` <li indexmenuId=${item.indexmenuId}>
                    <a href="${item.titlehref}"><img src="../assets/images/${count}.png" alt=""></a>
                    <p>${item.name}</p>
                </li > `
            $("#menu>ul")[0].innerHTML = lis
        });
        return res
    })
    .then(res => {
        let flag = true
        $("#menu>ul>li:eq(7)").click(function (e) {
            e.preventDefault()
            if (flag) {
                $("#menu").stop().animate({ height: "5.6rem" })
                flag = false;
            } else {
                $("#menu").stop().animate({ height: "8.24rem" })
                flag = true;
            }
        })
        return res
    })

let recommen = $.ajax({
    url: "http://chst.vip:1234/api/getmoneyctrl"
})
    .then(res => {
        console.log(res.result);
        let recommenLis = "";
        res.result.forEach(item => {
            recommenLis += `<li>
                <a href="discount.html?productid=${item.productId}">
                    <div>${item.productImgSm}</div>
                    <div>
                        <div class="toptitle">
                            <div>${item.productName}"</div>
                            <div>${item.productPinkage}</div>
                        </div>
                        <div class="bottomtimer">
                            <div class="shop">
                                <p>${item.productFrom}</p>
                                <p>${item.productTime}</p>
                            </div>
                            <div>${item.productComCount}</div>
                        </div>
                    </div>
                </a>
            </li>`
        })
        $("#recommen>ul")[0].innerHTML = recommenLis
    })

$("#footer>.dengruSpan>.backTop").click(function () {
    $("html").animate({ scrollTop: 0 }, 1000)
})